package com.dy.nygl.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.dy.nygl.mapper.EnergyParamterMapper;
import com.dy.nygl.pojo.EnergyParamter;
import com.dy.nygl.service.EnergyParamterService;

@Service("energyParamterService")

public class EnergyParamterServiceImpl implements EnergyParamterService{

	@Resource(name="energyParamterDAO")
	private EnergyParamterMapper energyParamterDAO;

	/**
	 * getEnergyParamterAllList 获得能耗参数列表
	 */
	public List<EnergyParamter> getEnergyParamter(int begin, int end) {
		List<EnergyParamter> list = energyParamterDAO.getEnergyParamterAllList();
		if(list != null && list.size() > 0) {
			if(list.size() > (end - begin)) {
				list.subList(begin, end);
			}
			return list;
		}
		return null;
	}

	/**
	 * getEnergyParamterCount 获得能耗参数总个数
	 */
	public int getEnergyParamterCount() {
		return energyParamterDAO.getEnergyParamterCount();
	}
	
	
	/**
	 * getEnergyParamterById 通过id获得某个能耗参数
	 */
	public EnergyParamter getEnergyParamterById(int id) {
		EnergyParamter ep = energyParamterDAO.getEnergyParamterById(id);
		if(ep != null) {
			return ep;
		}
		return null;
	}

	/**
	 * addEnergyParamter 添加一个能耗参数
	 */
	public void addEnergyParamter(EnergyParamter ep) {
		energyParamterDAO.addEnergyParamter(ep);
	}

	/**
	 * updateEnergyParamter 更新/编辑某个能耗参数
	 */
	public void updateEnergyParamter(EnergyParamter ep) {
		energyParamterDAO.updateEnergyParamter(ep);
	}

	/**
	 * deleteEnergyParamter 删除某个能耗参数
	 */
	public void deleteEnergyParamter(EnergyParamter ep) {
		energyParamterDAO.deleteEnergyParamter(ep);
	}

}
